package com.example.wb.myfirstandroid;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Main2Activity extends BaseActivity {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main2;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Button btn_login = (Button) findViewById(R.id.btn_login);
        btn_login.setOnClickListener(btn_login_ClickListener);
    }

    private View.OnClickListener btn_login_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //// TODO: 16-10-6 登录事件
            EditText txt1 = (EditText) findViewById(R.id.editText);
            EditText txt2 = (EditText) findViewById(R.id.editText2);
            String userName = txt1.getText().toString();
            String password = txt2.getText().toString();
            Toast.makeText(getApplicationContext(), "登录中..用户名：" + userName + " 密码:" + password, Toast.LENGTH_SHORT).show();
            Intent intent =new Intent(Main2Activity.this, CalculatorAction.class);
            startActivity(intent);
        }
    };
}
